<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>审核</title>
    <link href="../css/professional1.css" rel="stylesheet" type="text/css">
    <script src="../jQuery/jquery-3.3.1.js"></script>
    <script src="../layer/layer.js"></script>
    <script src="../jQuery/jquery-3.3.1.js"></script>
    <script src="../layer/layer.js"></script>
    <script src="../js/jquery-2.1.1.min.js"></script>
    <script src="../js/jquery.form.min.js"></script>
    <script src="../js/main.js"></script>
    <script src="../js/del.js "></script>

    <script src="../layer/layer.js"></script>
    <script>
        var id=URL;
        $.ajaxSetup({
            xhrFields: {
                withCredentials: isCrossDomain
            }
        });
        $(function () {
            var p=$.getUrlParam('pageno');
            var cid=$.getUrlParam('cid');

            $.get(mainurl+"root/getAllCollege",function (data) {
                var d=data.data;
                for(var i=0;i<d.length;i++){
                    var d1=d[i];
                    var cid=d1.cid;
                    var str=d1.college;
                    var college=str.substring(4);
                    if (i==0){
                        $("#select").append("<option value=\""+cid+"\">"+str+"</option>");
                    }else {
                        $("#select").append("<option value=\""+cid+"\">"+college+"</option>");
                    }

                }

            });

            /**
             *重要
             */
            $.get(mainurl+"root/getAllResult?pageno="+p+"&cid="+cid,function (data) {
                /**
                 *重要
                 */
                if(cid!=null){
                    document.getElementById("select").value=cid;
                }
                var pageNum=data.data.pageNum;
                var pages=data.data.pages;
                if(checkData(data)){
                    var dat = data.data.list;
                    for(var i=0; i<dat.length; i++) {
                        var d = dat[i];
                        var tid=d.rid;
                        var title=d.title;
                        var content=d.content;
                        var benefit=d.benefit;
                        var begin=toDate(d.begin);
                        var end=toDate(d.end);
                        var audit=d.audit;
                        if(audit==0){
                            str="未审核"
                        }if (audit==1){
                            str="通过";
                        }if (audit==-1) {
                            str="不通过";
                        }
                       /* var str1="  <div class=\"info\">\n" +
                            "            <div class=\"top\">\n" +
                            "                <div class=\"del\"><a onclick=\"delService("+tid+","+pageNum+")\"> <img src=\"../img/close.png\" style=\"width: 16px;height: 16px\"></a></div>\n" +
                            "                <div style=\"min-width: 200px\">\n" +
                            "                    <!--<img src=\"../img/teacher.jpg\" class=\"info_teach\">-->\n" +
                            "                    <p class=\"specific\">\n" +
                            "                        <label class=\"name\">成果标题:"+title+"</label><br/><label> 服务内容:"+content+" </label><br/><label>经济效益:"+benefit+"  </label><br/><label class=>服务起始时间:"+begin+"</label> <br/><label class=>服务结束时间:"+end+"</label> </p>\n" +
                            "                </div>\n" +
                            "            </div>\n" +
                            "            <div class=\"info_operation\">\n" +
                            "\n" +
                            "                <label onclick=\"examine("+pageNum+","+tid+")\"  class=\"operation\"><img src=\"../img/examine.png\" style=\"width: 20px;height: 18px\">审核:"+str+"</label>\n" +
                            "            </div>\n" +
                            "        </div>";
                        if((i+1)==1||(i+1)==4){
                            $("#information_left").append(str1);

                        }if((i+1)==2||(i+1)==5){
                            $("#information_middle").append(str1);

                        }if((i+1)==3||(i+1)==6){
                            $("#information_right").append(str1);

                        }*/
                        var str1="  <div class=\"info\">\n" +
                            "            <div class=\"top\">\n" +
                            "                <div class=\"del\"><a onclick=\"delService("+tid+","+pageNum+")\"> <img src=\"../img/close.png\" style=\"width: 16px;height: 16px\"></a></div>\n" +
                            "                <div style=\"min-width: 200px\">\n" +
                            "                    <!--<img src=\"../img/teacher.jpg\" class=\"info_teach\">-->\n" +
                            "                    <p class=\"specific\">\n" +
                            "                        <label class=\"name\">成果标题:"+title+"</label><br/><label> 服务内容:"+content+" </label><br/><label>经济效益:"+benefit+"  </label><br/><label class=>服务起始时间:"+begin+"</label> <br/><label class=>服务结束时间:"+end+"</label> </p>\n" +
                            "                </div>\n" +
                            "            </div>\n" +
                            "            <div class=\"info_operation\">\n" +
                            "\n" +
                            "                <label onclick=\"examine("+pageNum+","+tid+")\"  class=\"operation\"><img src=\"../img/examine.png\" style=\"width: 20px;height: 18px\">审核:"+str+"</label>\n" +
                            "            </div>\n" +
                            "        </div>";


                        $("#information").append(str1);
                    }
                }
                if(pageNum!=0){
                    xuhao(pageNum,pages);
                }else {
                    errorInfo("未查询到相关结果")
                }
            });

        })


        function delService(i,pageno) {
            layer.confirm('是否确认删除？', {
                btn: ['是的','取消'] //按钮
            }, function(){//y
                $.post(mainurl+"admin/deleteResult",{rid:i},function (data) {
                    if(checkData(data)) {
                        successInfo("删除成功");

                        /**
                         *重要
                         */
                        var se=document.getElementById("select").value;
                        window.location.href="Examine.html?pageno="+pageno+"&cid="+se;
                    }
                });
                layer.closeAll();
            }, function(){

            });
        }





        function tiaozhuan(pageno) {

            /**
             *重要
             */

            var se=document.getElementById("select").value;
           // alert(pageno+"===se:"+se);
            $.get(mainurl+"root/getAllResult?pageno="+pageno+"&cid="+se,function (data) {

                var pageNum=data.data.pageNum;
                var pages=data.data.pages;
                if(checkData(data)){

                    $("#information").empty();

                    var dat = data.data.list;
                    for(var i=0; i<dat.length; i++) {
                        var d = dat[i];
                        var tid=d.rid;
                        var title=d.title;
                        var content=d.content;
                        var benefit=d.benefit;
                        var begin=toDate(d.begin);
                        var end=toDate(d.end);
                        var audit=d.audit;
                        if(audit==0){
                            str="未审核"
                        }if (audit==1){
                            str="通过";
                        }if (audit==-1) {
                            str="不通过";
                        }
                      /*  var str1="  <div class=\"info\">\n" +
                            "            <div class=\"top\">\n" +
                            "                <div class=\"del\"><a onclick=\"delService("+tid+","+pageNum+")\"> <img src=\"../img/close.png\" style=\"width: 16px;height: 16px\"></a></div>\n" +
                            "                <div style=\"min-width: 200px\">\n" +
                            "                    <!--<img src=\"../img/teacher.jpg\" class=\"info_teach\">-->\n" +
                            "                    <p class=\"specific\">\n" +
                            "                        <label class=\"name\">成果标题:"+title+"</label><br/><label> 服务内容:"+content+" </label><br/><label>经济效益:"+benefit+"  </label><br/><label class=>服务起始时间:"+begin+"</label> <br/><label class=>服务结束时间:"+end+"</label> </p>\n" +
                            "                </div>\n" +
                            "            </div>\n" +
                            "            <div class=\"info_operation\">\n" +
                            "\n" +
                            "                <label onclick=\"examine("+pageNum+","+tid+")\"  class=\"operation\"><img src=\"../img/examine.png\" style=\"width: 20px;height: 18px\">审核:"+str+"</label>\n" +
                            "            </div>\n" +
                            "        </div>";
                        if((i+1)==1||(i+1)==4){
                            $("#information_left").append(str1);

                        }if((i+1)==2||(i+1)==5){
                            $("#information_middle").append(str1);

                        }if((i+1)==3||(i+1)==6){
                            $("#information_right").append(str1);

                        }*/
                        var str1="  <div class=\"info\">\n" +
                            "            <div class=\"top\">\n" +
                            "                <div class=\"del\"><a onclick=\"delService("+tid+","+pageNum+")\"> <img src=\"../img/close.png\" style=\"width: 16px;height: 16px\"></a></div>\n" +
                            "                <div style=\"min-width: 200px\">\n" +
                            "                    <!--<img src=\"../img/teacher.jpg\" class=\"info_teach\">-->\n" +
                            "                    <p class=\"specific\">\n" +
                            "                        <label class=\"name\">成果标题:"+title+"</label><br/><label> 服务内容:"+content+" </label><br/><label>经济效益:"+benefit+"  </label><br/><label class=>服务起始时间:"+begin+"</label> <br/><label class=>服务结束时间:"+end+"</label> </p>\n" +
                            "                </div>\n" +
                            "            </div>\n" +
                            "            <div class=\"info_operation\">\n" +
                            "\n" +
                            "                <label onclick=\"examine("+pageNum+","+tid+")\"  class=\"operation\"><img src=\"../img/examine.png\" style=\"width: 20px;height: 18px\">审核:"+str+"</label>\n" +
                            "            </div>\n" +
                            "        </div>";


                        $("#information").append(str1);
                    }
                    $("#xuhao").empty();
                    if(pageNum!=0){
                        xuhao(pageNum,pages);
                    }else {
                        errorInfo("未查询到相关结果")
                    }
                }

            });

        }


    </script>
</head>
<body>
<p class="p1">所在位置：技术服务信息·审核</p>

<div class="sousu">

    <label class="p2">所在学院：</label>
    <select class="sel1" id="select">
        <option selected></option>
    </select><button type="submit" id="searchCollege" onclick="serach()">搜索</button>


</div>
<div class="container">


    <div class="information" id="information"></div>
    <div class="information" style="margin-top: 50px" >
        <div class="page" style="margin-top: 100px;" id="xuhao">
        </div>
    </div>

</div>
<br/>




</body>

<script>
    var user = "";



    function serach(){
        var se=document.getElementById("select").value;
        //  alert("se;"+se);
        $.get(mainurl+"root/getAllResult?pageno=1&cid="+se,function (data) {

            var pageNum=data.data.pageNum;
            var pages=data.data.pages;
            if(checkData(data)){

                $("#information").empty();

                var dat = data.data.list;
               // alert(dat.length);
                for(var i=0; i<dat.length; i++) {
                    var d = dat[i];
                    var tid=d.rid;
                    var title=d.title;
                    var content=d.content;
                    var benefit=d.benefit;
                    var begin=toDate(d.begin);
                    var end=toDate(d.end);
                    var audit=d.audit;
                    if(audit==0){
                        str="未审核"
                    }if (audit==1){
                        str="通过";
                    }if (audit==-1) {
                        str="不通过";
                    }
                   /* var str1="  <div class=\"info\">\n" +
                        "            <div class=\"top\">\n" +
                        "                <div class=\"del\"><a onclick=\"delService("+tid+","+pageNum+")\"> <img src=\"../img/close.png\" style=\"width: 16px;height: 16px\"></a></div>\n" +
                        "                <div style=\"min-width: 200px\">\n" +
                        "                    <!--<img src=\"../img/teacher.jpg\" class=\"info_teach\">-->\n" +
                        "                    <p class=\"specific\">\n" +
                        "                        <label class=\"name\">成果标题:"+title+"</label><br/><label> 服务内容:"+content+" </label><br/><label>经济效益:"+benefit+"  </label><br/><label class=>服务起始时间:"+begin+"</label> <br/><label class=>服务结束时间:"+end+"</label> </p>\n" +
                        "                </div>\n" +
                        "            </div>\n" +
                        "            <div class=\"info_operation\">\n" +
                        "\n" +
                        "                <label onclick=\"examine("+pageNum+","+tid+")\"  class=\"operation\"><img src=\"../img/examine.png\" style=\"width: 20px;height: 18px\">审核:"+str+"</label>\n" +
                        "            </div>\n" +
                        "        </div>";
                    if((i+1)==1||(i+1)==4){
                        $("#information_left").append(str1);

                    }if((i+1)==2||(i+1)==5){
                        $("#information_middle").append(str1);

                    }if((i+1)==3||(i+1)==6){
                        $("#information_right").append(str1);

                    }*/
                    var str1="  <div class=\"info\">\n" +
                        "            <div class=\"top\">\n" +
                        "                <div class=\"del\"><a onclick=\"delService("+tid+","+pageNum+")\"> <img src=\"../img/close.png\" style=\"width: 16px;height: 16px\"></a></div>\n" +
                        "                <div style=\"min-width: 200px\">\n" +
                        "                    <!--<img src=\"../img/teacher.jpg\" class=\"info_teach\">-->\n" +
                        "                    <p class=\"specific\">\n" +
                        "                        <label class=\"name\">成果标题:"+title+"</label><br/><label> 服务内容:"+content+" </label><br/><label>经济效益:"+benefit+"  </label><br/><label class=>服务起始时间:"+begin+"</label> <br/><label class=>服务结束时间:"+end+"</label> </p>\n" +
                        "                </div>\n" +
                        "            </div>\n" +
                        "            <div class=\"info_operation\">\n" +
                        "\n" +
                        "                <label onclick=\"examine("+pageNum+","+tid+")\"  class=\"operation\"><img src=\"../img/examine.png\" style=\"width: 20px;height: 18px\">审核:"+str+"</label>\n" +
                        "            </div>\n" +
                        "        </div>";


                    $("#information").append(str1);
                }
                $("#xuhao").empty();
                if(pageNum!=0){
                    xuhao(pageNum,pages);
                }else {
                    errorInfo("未查询到相关结果")
                }
            }

        });
    }


    function examine(pageno,id) {
        layer.open({
            type: 1,
            title:'审核状态',
            area: ['400px', '200px'],
            closeBtn:1,
            shadeClose: true, //点击遮罩关闭
            content:'<label class="examine_state">'+'审核状态: '+'</label>'+'<select id="zhi" class="examine_sel">'
                +'<option value="0">未审核</option>'+'<option value="1">通过</option>'+'<option value="-1">未通过</option>'+'</select>'
                +'<button id="ex_sub" onclick="shenghe('+pageno+','+id+') ">'+'提交'+'</button>'
        });
    }

    function shenghe(a,b) {
        var zhi=document.getElementById("zhi").value;

        $.post(mainurl+"admin/resultToexaimn",{rid:b,audit:zhi},function (data) {
            if(checkData(data)) {
                successInfo("审核信息修改成功");

                /**
                 *重要
                 */
                var se=document.getElementById("select").value;
                window.location.href="Examine.html?pageno="+a+"&cid="+se;
            }
        });

    }

    function changepic() {
        var reads= new FileReader();
        f=document.getElementById('file').files[0];
        reads.readAsDataURL(f);
        reads.onload=function (e) {
            document.getElementById('show').src=this.result;
        };
    }
    function del() {
        var self = $(this);
        var flag = $(this).attr('flag');
        layer.confirm('是否确认删除？', {
            btn: ['确定','取消'] //按钮
        },function () {
            $.ajax({
                url: "",
                type: "post",
                data: {id: flag},
                dataType: "json",
                success: function (data) {
                    if(data == 1){
                        layer.msg('删除成功')
                        location.reload();
                    }
                    if (data == 0){
                        layer.msg('删除失败')
                        location.reload();
                    }
                }
            });
        });

    }

    $(function () {
        $('#searchName').click(function() {
            var text = $('#input').val(); //获取文本框输入
            var userName = $("#userName").val();
            if(text == userName ){

            }
        })
    })



</script>
</html>